package com.jm.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 管理员信息
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("admin")
public class Admin implements Serializable {

    private static final long serialVersionUID = 1L;
    //    id
    @TableId
    private Long id;
    //    名字
    private String name;
    //    用户名
    private String username;
    //    密码
    private String password;
    //    手机号
    private String phone;
    //    性别
    private String sex;

    //     该员工信息何时被创建，该字段只会在被添加时自动填充
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    //     该员工信息何时被修改，该字段只会在被添加/修改时自动填充
    @TableField(fill = FieldFill.INSERT_UPDATE,exist = false)
    private LocalDateTime updateTime;

    //      该员工被哪个管理员创建，该字段只会在被添加时自动填充
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;
    //      该员工被哪个管理员修改信息，该字段只会在被添加/修改时自动填充
    @TableField(fill = FieldFill.INSERT_UPDATE,exist = false)
    private Long updateUser;
    public Admin(String username, String password, String phone) {
        this.username = username;
        this.password = password;
        this.name = "超级管理员";
        this.phone = phone;
        this.sex = "男";
        this.createTime = LocalDateTime.now();
        this.createUser = 1l;
    }
}

